package cn.blunce.utils.XmlParse;

import org.xml.sax.SAXException;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class SAXParsePerson {

    public static List<Person> getPersons(InputStream in) throws SAXException,
            IOException, Exception {
        SAXParsePersonHelper handler = new SAXParsePersonHelper();
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser saxParser = spf.newSAXParser();
        saxParser.parse(in, handler);
        in.close();
        return handler.getPersons();
    }

}
